const log4js = require("log4js")
const { debug } =  require("../configure")

const conf = {
    appenders: {
        file: {
            type: 'dateFile',
            filename: 'logs/career.log',
            pattern: '-yyyy-MM-dd-hh.log'
        },
        console: {
            type: 'console'
        }
    },
    categories: {
        default: {
            appenders: ['console'],
            level: 'info'
        },
        prod: {
            appenders: ['file', 'console'],
            level: 'info'
        }
    }
};

let category = 'default';
if (!debug) {
    category = 'prod';
}
log4js.configure(conf);
module.exports = log4js.getLogger(category);
